<template>
  <el-tabs type="border-card" style="height: 400px">
    <el-tab-pane label="年度能耗总结">
      <el-table
          :data="list"
          style="width: 100%">
        <el-table-column
            prop="energyName"
            label="类型"
            width="50">
        </el-table-column>
        <el-table-column
            prop="increaseRealValue"
            label="累计用量"
            width="110">
        </el-table-column>
        <el-table-column
            prop="increaseStandValue"
            label="转标准煤"
            width="110">
        </el-table-column>
        <!--
        <el-table-column
            prop="increaseCashValue"
            label="转货币"
            width="110">
        </el-table-column>
        -->
        <el-table-column
            prop="compareToLast"
            label="同比(去年同期)"
            width="130">
        </el-table-column>
      </el-table>
    </el-tab-pane>
  </el-tabs>
</template>
<script>

export default {
  data() {
    return {
      list: []
    }
  },
  mounted() {
    this.fetchData()
  },
  unmounted() {
  },
  methods: {
    fetchData: function () {
      const data = {content: {}}
      const doubleLab = this.$doubleLab
      this.$axios({url:'/ems/client/index/energy/year/summarize', data: data}).then((content) => {
        content.list.forEach(function (item) {
          item.increaseStandValue = doubleLab(item.increaseStandValue) + ' ' + content.standUnit
          item.increaseRealValue = doubleLab(item.increaseRealValue) + ' ' + item.unit
          item.increaseCashValue = doubleLab(item.increaseCashValue) + ' ' + content.cashUnit
        })
        this.list = content.list
      })
    }
  }
};
</script>
<style></style>
